#pragma once

#include <QScriptEngine>
#include <QSortFilterProxyModel>

class spx_filter_proxy_model : public QSortFilterProxyModel
{
    Q_OBJECT

public:
    spx_filter_proxy_model(QObject * parent = 0);

public:
    void set_filter(QString filter) { filter_str = filter; }
    QString get_filter() const { return filter_str; }

protected:
    virtual bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const;

private:
    bool do_filter(QAbstractItemModel* srcModel, int source_row, const QModelIndex & source_parent) const;

private:
    QString filter_str;
    QScriptEngine *myEngine;
};
